C-Level Extensibility > The C-level extensibility API > JSBool JS_ValueToBoolean()

 

JSBool JS_ValueToBoolean()

Description

Extracts a function argument from a jsval, converts it to a Boolean value (if possible), and passes the converted value back to the caller.

Arguments

JSContext *cx, jsval v, JSBool *bp

cx is the opaque JSContext pointer that was passed to the JavaScript function.
v is the jsval from which the string is to be extracted.
bp is a pointer to a JSBool. This function stores the converted value in *bp.

Returns

A Boolean value indicating success (JS_TRUE) or failure (JS_FALSE).